/*****************************************************************
**                                                             	**
**  Copyright (C) 2004 Amlogic,Inc.                            	**
**  All rights reserved                                        	**
**        Filename : logo.c /Project:AVOS		       **
**        Revision : 1.0                                       	**
**                                                             	**
*****************************************************************/
#include "../menu.h"
#include "logoEvent.h"
#include "./win/NetmenuSetupEvent.h"
#include "../aw_gui_app.h"

extern INT32U NODIR_FLAG;
INT32S WinLogoMsgProc(PHWND hwnd, INT32U msg_type, INT32S lpParam)
{
    switch( msg_type){
        case WM_SHOWWINDOW:
            return LogoOnShow(hwnd, lpParam) ;
		case WM_HIDEWINDOW:
			return LogoOnHide(hwnd, lpParam);
			
		default:
			return 0 ;
    }
    return 0 ;
}

void SetWinLogoPalette(void)
{
    YUVENTRY mask_para[4] = {0,79,4095,4095};
    AWSetAlphaMask(0,4, mask_para);
	YUVENTRY palette_para[16] = {0x8000 | 16392,0x8000 | 21176,0x8000 | 17752,0x8000 | 16392,17592,19496,19832,19656,19992,18104,17673,17817,15864,15721,15912,9849};
    AWSetPalette(0,16, palette_para);
    return ;
}

void SetWinLogoPos(HWND* pControl, INT8U CurOsdSize)
{
    switch(CurOsdSize){
	case OsdSize576i:
	case OsdSize576p:
	case OsdSize576iCVBS:	
            RECT Draw576WindowRect = {0,0,720,576};
            pControl->winrect = Draw576WindowRect;
            CREATEWINDOWPARAM Draw576WindowPara = {1,{{0,0,720,576},    {0,0,0,0},{0,0,0,0},{0,0,0,0}},{PF_PALETTE_256,0,0,0},    SetWinLogoPalette};
            AWSendMessage(pControl, WM_WINDOW_RESET_DRAW_AREA, (INT32S)&Draw576WindowPara);
            break ;

	case OsdSize480i:
	case OsdSize480p:
	case OsdSize480iCVBS:
            RECT NormalWindowRect = {0,0,720,480};
            pControl->winrect = NormalWindowRect;
            CREATEWINDOWPARAM NormalWindowPara = {1,{{0,0,720,480},    {0,0,0,0},{0,0,0,0},{0,0,0,0}},{PF_PALETTE_256,0,0,0},    SetWinLogoPalette};
            AWSendMessage(pControl, WM_WINDOW_RESET_DRAW_AREA, (INT32S)&NormalWindowPara);
            break ;	
			
    #ifdef SUPPORT_VGA
	case OsdSizeVga:
            RECT VgaWindowRect = {0,0,1024,768};
            pControl->winrect = VgaWindowRect;
            CREATEWINDOWPARAM VgaWindowPara = {1,{{0,0,1024,768},    {0,0,0,0},{0,0,0,0},{0,0,0,0}},{PF_PALETTE_256,0,0,0},    SetWinLogoPalette};
            AWSendMessage(pControl, WM_WINDOW_RESET_DRAW_AREA, (INT32S)&VgaWindowPara);
            break ;	
    #endif

    }//end of switch
    return;
}

HWND *CreateControlWinLogo(HWND* pParent,INT8U CurOsdSize)
{
    HWND* pNewControl;
    switch(CurOsdSize){

	case OsdSize576i:
	case OsdSize576p:
	case OsdSize576iCVBS:	
            CREATEWINDOWPARAM Draw576window_para = {1,{{0,0,720,576},{0,0,0,0},{0,0,0,0},{0,0,0,0}},{PF_PALETTE_256,0,0,0},SetWinLogoPalette};
            //Create Menu Window -- 1
            pNewControl = AWCreateWinControl("TWindow","WinLogo",WS_OVERLAPPEDWINDOW,
		                      0,0,720,576,NULL, (INT32S)&Draw576window_para,WinLogoMsgProc) ;
            pNewControl->win_id = 0 ;
            break ;

	case OsdSize480i:
	case OsdSize480p:
	case OsdSize480iCVBS:
            CREATEWINDOWPARAM Normalwindow_para = {1,{{0,0,720,480},{0,0,0,0},{0,0,0,0},{0,0,0,0}},{PF_PALETTE_256,0,0,0},SetWinLogoPalette};
            //Create Menu Window -- 1
            pNewControl = AWCreateWinControl("TWindow","WinLogo",WS_OVERLAPPEDWINDOW,
		                      0,0,720,480,NULL, (INT32S)&Normalwindow_para,WinLogoMsgProc) ;
            pNewControl->win_id = 0 ;
            break ;

    #ifdef SUPPORT_VGA
	case OsdSizeVga:
            CREATEWINDOWPARAM Vgawindow_para = {1,{{0,0,1024,768},{0,0,0,0},{0,0,0,0},{0,0,0,0}},{PF_PALETTE_256,0,0,0},SetWinLogoPalette};
            //Create Menu Window -- 1
            pNewControl = AWCreateWinControl("TWindow","WinLogo",WS_OVERLAPPEDWINDOW,
		                      0,0,1024,768,NULL, (INT32S)&Vgawindow_para,WinLogoMsgProc) ;
            pNewControl->win_id = 0 ;
            break ;	
    #endif
    }//end of switch
    return pNewControl;
}


void SetFileListViewPos(HWND* pControl, INT8U CurOsdSize)
{
    int iLoop ;
    if(strcmp(pControl->pClass->class_name, "TFilelist"))
        return ;
    TFILELIST *pList = (TFILELIST *)pControl;
    switch(CurOsdSize){

	case OsdSize576i:
	case OsdSize576p:
	case OsdSize576iCVBS:	
            pControl->winrect.top = pControl->parent->winrect.top + (170);
            pControl->winrect.left = pControl->parent->winrect.left + (98);
            pControl->winrect.width = (248);
            pControl->winrect.height = (266);
            pControl->draw_info_num = 0;
            RECT Draw576DrawRect[0] = {
            };
            for(iLoop=0; iLoop < 0; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &Draw576DrawRect[iLoop], sizeof(RECT));
            pList->filelist_bmp_start_x = (10);
            pList->filelist_bmp_start_y = (0);
            pList->filelist_title_start_x = (50);
            pList->filelist_title_start_y = (6);
            pList->filelist_hint_info.draw_pos_x = pControl->winrect.left + (0);
            pList->filelist_hint_info.draw_pos_y  = pControl->winrect.top + (0);
            pList->filelist_hint_info.draw_width = (0);
            pList->filelist_hint_info.draw_height = (0);
            pList->list_up_arrow_info.draw_pos_x = pControl->winrect.left + (0);
            pList->list_up_arrow_info.draw_pos_y  = pControl->winrect.top ; 
            pList->list_up_arrow_info.draw_width = pControl->winrect.width + pList->list_up_arrow_info.draw_pos_x - pControl->winrect.left;
            pList->list_up_arrow_info.draw_height = (0);
            pList->list_down_arrow_info.draw_pos_x = pList->list_up_arrow_info.draw_pos_x;
            pList->list_down_arrow_info.draw_pos_y  = pControl->winrect.top + pControl->winrect.height - pList->list_up_arrow_info.draw_height; 
            pList->list_down_arrow_info.draw_width = pList->list_up_arrow_info.draw_width ;
            pList->list_down_arrow_info.draw_height = pList->list_up_arrow_info.draw_height;
            break ;

	case OsdSize480i:
	case OsdSize480p:
	case OsdSize480iCVBS:	
            pControl->winrect.top = pControl->parent->winrect.top + (122);
            pControl->winrect.left = pControl->parent->winrect.left + (98);
            pControl->winrect.width = (248);
            pControl->winrect.height = (266);
            pControl->draw_info_num = 0;
            RECT NormalDrawRect[0] = {
            };
            for(iLoop=0; iLoop < 0; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &NormalDrawRect[iLoop], sizeof(RECT));
            pList->filelist_bmp_start_x = (10);
            pList->filelist_bmp_start_y = (0);
            pList->filelist_title_start_x = (50);
            pList->filelist_title_start_y = (6);
            pList->filelist_hint_info.draw_pos_x = pControl->winrect.left + (0);
            pList->filelist_hint_info.draw_pos_y  = pControl->winrect.top + (0);
            pList->filelist_hint_info.draw_width = (0);
            pList->filelist_hint_info.draw_height = (0);
            pList->list_up_arrow_info.draw_pos_x = pControl->winrect.left + (0);
            pList->list_up_arrow_info.draw_pos_y  = pControl->winrect.top ; 
            pList->list_up_arrow_info.draw_width = pControl->winrect.width + pList->list_up_arrow_info.draw_pos_x - pControl->winrect.left;
            pList->list_up_arrow_info.draw_height = (0);
            pList->list_down_arrow_info.draw_pos_x = pList->list_up_arrow_info.draw_pos_x;
            pList->list_down_arrow_info.draw_pos_y  = pControl->winrect.top + pControl->winrect.height - pList->list_up_arrow_info.draw_height; 
            pList->list_down_arrow_info.draw_width = pList->list_up_arrow_info.draw_width ;
            pList->list_down_arrow_info.draw_height = pList->list_up_arrow_info.draw_height;
            break ;
#ifdef SUPPORT_VGA
case OsdSizeVga:
            pControl->winrect.top = pControl->parent->winrect.top + (122)+WinStart_y;
            pControl->winrect.left = pControl->parent->winrect.left + (98)+WinStart_x;
            pControl->winrect.width = (248);
            pControl->winrect.height = (266);
            pControl->draw_info_num = 0;
            RECT VgaDrawRect[0] = {
            };
            for(iLoop=0; iLoop < 0; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &VgaDrawRect[iLoop], sizeof(RECT));
            pList->filelist_bmp_start_x = (10);
            pList->filelist_bmp_start_y = (0);
            pList->filelist_title_start_x = (50);
            pList->filelist_title_start_y = (6);
            pList->filelist_hint_info.draw_pos_x = pControl->winrect.left + (0);
            pList->filelist_hint_info.draw_pos_y  = pControl->winrect.top + (0);
            pList->filelist_hint_info.draw_width = (0);
            pList->filelist_hint_info.draw_height = (0);
            pList->list_up_arrow_info.draw_pos_x = pControl->winrect.left + (0);
            pList->list_up_arrow_info.draw_pos_y  = pControl->winrect.top ; 
            pList->list_up_arrow_info.draw_width = pControl->winrect.width + pList->list_up_arrow_info.draw_pos_x - pControl->winrect.left;
            pList->list_up_arrow_info.draw_height = (0);
            pList->list_down_arrow_info.draw_pos_x = pList->list_up_arrow_info.draw_pos_x;
            pList->list_down_arrow_info.draw_pos_y  = pControl->winrect.top + pControl->winrect.height - pList->list_up_arrow_info.draw_height; 
            pList->list_down_arrow_info.draw_width = pList->list_up_arrow_info.draw_width ;
            pList->list_down_arrow_info.draw_height = pList->list_up_arrow_info.draw_height;
            break ;
#endif

    }//end of switch
    return;
}

INT32S FileListViewMsgProc(PHWND hwnd, INT32U msg_type, INT32S lpParam)
{
    switch( msg_type){
        case WM_SHOWWINDOW:
                return FileListViewOnShow_nodir(hwnd, lpParam) ;
        case WM_KEYDOWN:
                return FileListViewOnKeyPress_nodir(hwnd, lpParam) ;
		case WM_PAINT:
				return FileListViewOnPaint(hwnd, lpParam);
		default:
                return FileListViewOnOtherEvent(hwnd, msg_type, lpParam);
    }
    return 0 ;
}

HWND *CreateControlFileListView(HWND *pParent,INT8U CurOsdSize)
{
    //Create Control -- FileListView
    HWND *pNewControl;
    TFILELIST *pList;
    switch(CurOsdSize){

	case OsdSize576i:
	case OsdSize576p:
	case OsdSize576iCVBS:	
            pNewControl = AWCreateWinControl("TFilelist","FileListView",(WS_CHILDWINDOW | WS_CHILDWINDOW),
		                      98,170,248,266,pParent, 7, FileListViewMsgProc) ;
            pNewControl->win_id = 6 ;
            pNewControl->draw_info_num = 0;
            pList = (TFILELIST *)pNewControl;
            TFILELIST Draw576FileList = {{}, 0,
                          7,0,0,0,270,
                          (INT32U)ICON_FILELIST_BAR_LOSE,
                          (INT32U)ICON_FILELIST_BAR_FOCUS,
                          (INT32U)ICON_FILELIST_BAR_LOSE,
#ifndef AML_DIR
                          (INT32U)ICON_FILELIST_BAR_LOSE,
#else
			                    (INT32U)ICON_FILELIST_BAR_FOCUS,
#endif
                          (INT32U)ICON_FILELIST_BAR_FOCUS,
                          (INT32U)ICON_FILELIST_BAR_FOCUS,
                          (INT32U)ICON_FILELIST_BAR_FOCUS,
                          (INT32U)ICON_FILELIST_BAR_LOSE,
                          (INT32U)ICON_FILELIST_BAR_FOCUS,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          0,0,0,0,
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RESOURCE_STRING_DATA},
                           NULL,
                           GetNextFileListCB,
                           GetPrevFileListCB,
                           CDNewDir,
                           GetFullName,
                           CDRootDir};
            Draw576FileList.filelist_items = pList->filelist_items ;
            Draw576FileList.hwnd = pList->hwnd ;
            *pList =Draw576FileList;
            break ;

	case OsdSize480i:
	case OsdSize480p:
	case OsdSize480iCVBS:	
            pNewControl = AWCreateWinControl("TFilelist","FileListView",(WS_CHILDWINDOW | WS_CHILDWINDOW),
		                      98,122,248,266,pParent, 7, FileListViewMsgProc) ;
            pNewControl->win_id = 6 ;
            pNewControl->draw_info_num = 0;
            pList = (TFILELIST *)pNewControl;
            TFILELIST NormalFileList = {{}, 0,
                          7,0,0,0,270,
                          (INT32U)ICON_FILELIST_BAR_LOSE,
                          (INT32U)ICON_FILELIST_BAR_FOCUS,
                          (INT32U)ICON_FILELIST_BAR_LOSE,
#ifndef AML_DIR
                          (INT32U)ICON_FILELIST_BAR_LOSE,
#else
			     (INT32U)ICON_FILELIST_BAR_FOCUS,
#endif
                          (INT32U)ICON_FILELIST_BAR_FOCUS,
                          (INT32U)ICON_FILELIST_BAR_FOCUS,
                          (INT32U)ICON_FILELIST_BAR_FOCUS,
                          (INT32U)ICON_FILELIST_BAR_LOSE,
                          (INT32U)ICON_FILELIST_BAR_FOCUS,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          0,0,0,0,
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RESOURCE_STRING_DATA},
                           NULL,
                           GetNextFileListCB,
                           GetPrevFileListCB,
                           CDNewDir,
                           GetFullName,
                           CDRootDir};
            NormalFileList.filelist_items = pList->filelist_items ;
            NormalFileList.hwnd = pList->hwnd ;
            *pList = NormalFileList;
            break ;
    #ifdef SUPPORT_VGA
	case OsdSizeVga:
            pNewControl = AWCreateWinControl("TFilelist","FileListView",(WS_CHILDWINDOW | WS_CHILDWINDOW),
		                      98+WinStart_x,122+WinStart_y,248,266,pParent, 7, FileListViewMsgProc) ;
            pNewControl->win_id = 6 ;
            pNewControl->draw_info_num = 0;
            pList = (TFILELIST *)pNewControl;
            TFILELIST VgaFileList = {{}, 0,
                          7,0,0,0,270,
                          (INT32U)ICON_FILELIST_BAR_LOSE,
                          (INT32U)ICON_FILELIST_BAR_FOCUS,
                          (INT32U)ICON_FILELIST_BAR_LOSE,
#ifndef AML_DIR
                          (INT32U)ICON_FILELIST_BAR_LOSE,
#else
			     (INT32U)ICON_FILELIST_BAR_FOCUS,
#endif
                          (INT32U)ICON_FILELIST_BAR_FOCUS,
                          (INT32U)ICON_FILELIST_BAR_FOCUS,
                          (INT32U)ICON_FILELIST_BAR_FOCUS,
                          (INT32U)ICON_FILELIST_BAR_LOSE,
                          (INT32U)ICON_FILELIST_BAR_FOCUS,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          DT_RLE_BMP_DATA,
                          0,0,0,0,
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RESOURCE_STRING_DATA},
                           NULL,
                           GetNextFileListCB,
                           GetPrevFileListCB,
                           CDNewDir,
                           GetFullName,
                           CDRootDir};
            VgaFileList.filelist_items = pList->filelist_items ;
            VgaFileList.hwnd = pList->hwnd ;
            *pList = VgaFileList;
            break ;
    #endif
    }//end of switch
            return pNewControl;
}

void SetMusic_Spectrum_PanelPos(HWND* pControl, INT8U CurOsdSize)
{
    int iLoop;
    switch(CurOsdSize){
	case OsdSize576i:
	case OsdSize576p:
	case OsdSize576iCVBS:	
            pControl->winrect.top = pControl->parent->winrect.top + 164;
            pControl->winrect.left = pControl->parent->winrect.left + 372;
            pControl->winrect.width = 140;
            pControl->winrect.height = 100;
            pControl->draw_info_num = 17;
            RECT Draw576DrawRect[17] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,140,100},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 10,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 20,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 30,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 40,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 50,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 60,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 70,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 80,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 90,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 100,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 110,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 120,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 130,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,0,0},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,0,0},
            };
            for(iLoop=0; iLoop < 17; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &Draw576DrawRect[iLoop], sizeof(RECT));
            break ;
            
	case OsdSize480i:
	case OsdSize480p:
	case OsdSize480iCVBS:	
            pControl->winrect.top = pControl->parent->winrect.top + 116 ;
            pControl->winrect.left = pControl->parent->winrect.left + 372;
            pControl->winrect.width = 140;
            pControl->winrect.height = 100;
            pControl->draw_info_num = 17;
            RECT NormalDrawRect[17] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,140,100},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 10,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 20,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 30,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 40,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 50,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 60,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 70,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 80,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 90,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 100,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 110,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 120,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 130,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,0,0},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,0,0},
            };
            for(iLoop=0; iLoop < 17; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &NormalDrawRect[iLoop], sizeof(RECT));
            break ;

	#ifdef SUPPORT_VGA
	case OsdSizeVga:
            pControl->winrect.top = pControl->parent->winrect.top + 116+WinStart_y ;
            pControl->winrect.left = pControl->parent->winrect.left + 372+WinStart_x;
            pControl->winrect.width = 140;
            pControl->winrect.height = 100;
            pControl->draw_info_num = 17;
            RECT VgaDrawRect[17] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,140,100},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 10,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 20,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 30,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 40,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 50,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 60,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 70,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 80,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 90,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 100,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 110,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 120,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 130,pControl->winrect.top + 0,8,100},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,0,0},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,0,0},
            };
            for(iLoop=0; iLoop < 17; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &VgaDrawRect[iLoop], sizeof(RECT));
            break ;		
	#endif
    }//end of switch
    return;
}

HWND *CreateControlMusic_Spectrum_Panel(HWND *pParent,INT8U CurOsdSize)
{
    //Create Control -- Music_Spectrum_Panel
    HWND *pNewControl;
    switch(CurOsdSize){
	case OsdSize576i:
	case OsdSize576p:
	case OsdSize576iCVBS:	
            pNewControl = AWCreateWinControl("TControl","Music_Spectrum_Panel",(WS_CHILDWINDOW | WS_DISVISIBLE),
		                      372,164,140,100,pParent,0,NULL) ;
            pNewControl->win_id = 13 ;
            pNewControl->draw_info_num = 17;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO Draw576DrawDatas[17] = {
                          {0,0,140,100,(INT32U)ICON_MUSIC_SPECTRUM_BK,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA}};            	
                          
            memcpy(pNewControl->draw_info,Draw576DrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;

	case OsdSize480i:
	case OsdSize480p:
	case OsdSize480iCVBS:	
            pNewControl = AWCreateWinControl("TControl","Music_Spectrum_Panel",(WS_CHILDWINDOW | WS_DISVISIBLE),
		                      372,116,140,100,pParent,0,NULL) ;
            pNewControl->win_id = 13 ;
            pNewControl->draw_info_num = 17;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO NormalDrawDatas[17] = {
                          {0,0,140,100,(INT32U)ICON_MUSIC_SPECTRUM_BK,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA}};            	
                          
            memcpy(pNewControl->draw_info,NormalDrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;
			
	#ifdef SUPPORT_VGA
	case OsdSizeVga:
            pNewControl = AWCreateWinControl("TControl","Music_Spectrum_Panel",(WS_CHILDWINDOW | WS_DISVISIBLE),
		                      372+WinStart_x,116+WinStart_y,140,100,pParent,0,NULL) ;
            pNewControl->win_id = 13 ;
            pNewControl->draw_info_num = 17;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO VgaDrawDatas[17] = {
                          {0,0,140,100,(INT32U)ICON_MUSIC_SPECTRUM_BK,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA}};            	
                          
            memcpy(pNewControl->draw_info,VgaDrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;		
	#endif
    }//end of switch
            return pNewControl;
}

void SetMusic_ProcessBar_PanelPos(HWND* pControl, INT8U CurOsdSize)
{
    int iLoop;
    switch(CurOsdSize){
	case OsdSize576i:
	case OsdSize576p:    	
	case OsdSize576iCVBS:	
            pControl->winrect.top = pControl->parent->winrect.top + 280;
            pControl->winrect.left = pControl->parent->winrect.left + 362;
            pControl->winrect.width = 290;
            pControl->winrect.height = 42;
            pControl->draw_info_num = 6;
            RECT Draw576DrawRect[6] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,290,42},
            {pControl->winrect.left + 10,pControl->winrect.top + 4,32,32},
            {pControl->winrect.left + 42,pControl->winrect.top + 4,32,32},
            {pControl->winrect.left + 94,pControl->winrect.top + 17,132,8},
            {pControl->winrect.left + 230,pControl->winrect.top + 0,60,42},
            {pControl->winrect.left + 230,pControl->winrect.top + 10,60,32},
            };
            for(iLoop=0; iLoop < 6; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &Draw576DrawRect[iLoop], sizeof(RECT));
            break ;
            
	case OsdSize480i:
	case OsdSize480p:
	case OsdSize480iCVBS:	
            pControl->winrect.top = pControl->parent->winrect.top + 232;
            pControl->winrect.left = pControl->parent->winrect.left + 362;
            pControl->winrect.width = 290;
            pControl->winrect.height = 42;
            pControl->draw_info_num = 6;
            RECT NormalDrawRect[6] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,230,42},
            {pControl->winrect.left + 10,pControl->winrect.top + 4,32,32},
            {pControl->winrect.left + 42,pControl->winrect.top + 4,32,32},
            {pControl->winrect.left + 94,pControl->winrect.top + 17,132,8},
            {pControl->winrect.left + 230,pControl->winrect.top + 0,60,42},
            {pControl->winrect.left + 230,pControl->winrect.top + 10,60,32},
            };
            for(iLoop=0; iLoop < 6; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &NormalDrawRect[iLoop], sizeof(RECT));
            break ;

	#ifdef SUPPORT_VGA
	case OsdSizeVga:
            pControl->winrect.top = pControl->parent->winrect.top + 232+WinStart_y;
            pControl->winrect.left = pControl->parent->winrect.left + 362+WinStart_x;
            pControl->winrect.width = 290;
            pControl->winrect.height = 42;
            pControl->draw_info_num = 6;
            RECT VgaDrawRect[6] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,230,42},
            {pControl->winrect.left + 10,pControl->winrect.top + 4,32,32},
            {pControl->winrect.left + 42,pControl->winrect.top + 4,32,32},
            {pControl->winrect.left + 94,pControl->winrect.top + 17,132,8},
            {pControl->winrect.left + 230,pControl->winrect.top + 0,60,42},
            {pControl->winrect.left + 230,pControl->winrect.top + 10,60,32},
            };
            for(iLoop=0; iLoop < 6; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &VgaDrawRect[iLoop], sizeof(RECT));
            break ;		
	#endif
    }//end of switch
    return;
}

HWND *CreateControlMusic_ProcessBar_Panel(HWND *pParent,INT8U CurOsdSize)
{
    //Create Control -- Music_ProcessBar_Panel
    HWND *pNewControl;
    switch(CurOsdSize){
	case OsdSize576i:
	case OsdSize576p:
	case OsdSize576iCVBS:	
            pNewControl = AWCreateWinControl("TControl","Music_ProcessBar_Panel",(WS_CHILDWINDOW | WS_DISVISIBLE),
		                      362,280,290,42,pParent,0,NULL) ;
            pNewControl->win_id = 14 ;
            pNewControl->draw_info_num = 6;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;            
            DRAWINFO Draw576DrawDatas[6] = {
                          {0,0,290,42,(INT32U)ICON_MUSIC_PLAY_BAR_BK,DT_RLE_BMP_DATA},
                          {10,4,32,32,(INT32U)ICON_INFO_BLANK,DT_RLE_BMP_DATA},                          
                          {42,4,32,32,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,132,8,(INT32U)ICON_MUSIC_PROCESSBAR_BLANK,DT_RLE_BMP_DATA},
                          {0,0,60,42,(INT32U)ICON_MUSIC_TIME_BLANK,DT_RLE_BMP_DATA},
                          {0,0,60,32,(INT32U)mediabox_time_str,DT_STRING_DATA},
                          };
            memcpy(pNewControl->draw_info,Draw576DrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;            
            break ;
            
	case OsdSize480i:
	case OsdSize480p:
	case OsdSize480iCVBS:	
            pNewControl = AWCreateWinControl("TControl","Music_ProcessBar_Panel",(WS_CHILDWINDOW | WS_DISVISIBLE),
		                      362,232,290,42,pParent,0,NULL) ;
            pNewControl->win_id = 14 ;
            pNewControl->draw_info_num = 6;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;            
            DRAWINFO NormalDrawDatas[6] = {
                          {0,0,290,42,(INT32U)ICON_MUSIC_PLAY_BAR_BK,DT_RLE_BMP_DATA},
                          {10,4,32,32,(INT32U)ICON_INFO_BLANK,DT_RLE_BMP_DATA},                          
                          {42,4,32,32,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,132,8,(INT32U)ICON_MUSIC_PROCESSBAR_BLANK,DT_RLE_BMP_DATA},
                          {0,0,60,42,(INT32U)ICON_MUSIC_TIME_BLANK,DT_RLE_BMP_DATA},
                          {0,0,60,32,(INT32U)mediabox_time_str,DT_STRING_DATA},
                          };
            memcpy(pNewControl->draw_info,NormalDrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;            
            break ;

	#ifdef SUPPORT_VGA
	case OsdSizeVga:
            pNewControl = AWCreateWinControl("TControl","Music_ProcessBar_Panel",(WS_CHILDWINDOW | WS_DISVISIBLE),
		                      362+WinStart_x,232+WinStart_y,290,42,pParent,0,NULL) ;
            pNewControl->win_id = 14 ;
            pNewControl->draw_info_num = 6;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;            
            DRAWINFO VgaDrawDatas[6] = {
                          {0,0,290,42,(INT32U)ICON_MUSIC_PLAY_BAR_BK,DT_RLE_BMP_DATA},
                          {10,4,32,32,(INT32U)ICON_INFO_BLANK,DT_RLE_BMP_DATA},                          
                          {42,4,32,32,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,132,8,(INT32U)ICON_MUSIC_PROCESSBAR_BLANK,DT_RLE_BMP_DATA},
                          {0,0,60,42,(INT32U)ICON_MUSIC_TIME_BLANK,DT_RLE_BMP_DATA},
                          {0,0,60,32,(INT32U)mediabox_time_str,DT_STRING_DATA},
                          };
            memcpy(pNewControl->draw_info,VgaDrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;            
            break ;		
	#endif
    }//end of switch
            return pNewControl;
}

void SetMusic_FileInfo_PanelPos(HWND* pControl, INT8U CurOsdSize)
{
    int iLoop;
    switch(CurOsdSize){
	case OsdSize576i:
	case OsdSize576p:
	case OsdSize576iCVBS:	
            pControl->winrect.top = pControl->parent->winrect.top + 332;
            pControl->winrect.left = pControl->parent->winrect.left + 362;
            pControl->winrect.width = 290;
            pControl->winrect.height = 138;
            pControl->draw_info_num = 9;
            RECT Draw576DrawRect[9] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,290,138},
            
            {pControl->winrect.left + 10,pControl->winrect.top + 0,100,28},
            {pControl->winrect.left + 10,pControl->winrect.top + 28,100,28},
            {pControl->winrect.left + 10,pControl->winrect.top + 56,100,28},
            {pControl->winrect.left + 10,pControl->winrect.top + 84,100,28},
            
            {pControl->winrect.left + 110,pControl->winrect.top + 0,184,28},
            {pControl->winrect.left + 110,pControl->winrect.top + 28,184,28},
            {pControl->winrect.left + 110,pControl->winrect.top + 56,184,28},
            {pControl->winrect.left + 110,pControl->winrect.top + 84,184,28},            
            };
            for(iLoop=0; iLoop < 9; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &Draw576DrawRect[iLoop], sizeof(RECT));
            break ;
            
	case OsdSize480i:
	case OsdSize480p:
	case OsdSize480iCVBS:	
            pControl->winrect.top = pControl->parent->winrect.top + 284;
            pControl->winrect.left = pControl->parent->winrect.left + 362;
            pControl->winrect.width = 290;
            pControl->winrect.height = 138;
            pControl->draw_info_num = 9;
            RECT NormalDrawRect[9] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,290,138},
            
            {pControl->winrect.left + 10,pControl->winrect.top + 0,100,28},
            {pControl->winrect.left + 10,pControl->winrect.top + 28,100,28},
            {pControl->winrect.left + 10,pControl->winrect.top + 56,100,28},
            {pControl->winrect.left + 10,pControl->winrect.top + 84,100,28},
            
            {pControl->winrect.left + 110,pControl->winrect.top + 0,160,28},
            {pControl->winrect.left + 110,pControl->winrect.top + 28,160,28},
            {pControl->winrect.left + 110,pControl->winrect.top + 56,160,28},
            {pControl->winrect.left + 110,pControl->winrect.top + 84,160,28},            
            };
            for(iLoop=0; iLoop < 9; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &NormalDrawRect[iLoop], sizeof(RECT));
            break ;

	#ifdef SUPPORT_VGA
	case OsdSizeVga:
            pControl->winrect.top = pControl->parent->winrect.top + 284+WinStart_y;
            pControl->winrect.left = pControl->parent->winrect.left + 362+WinStart_x; ///////////????????????
            pControl->winrect.width = 290;
            pControl->winrect.height = 138;
            pControl->draw_info_num = 9;
            RECT VgaDrawRect[9] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,290,138},
            
            {pControl->winrect.left + 10,pControl->winrect.top + 0,100,28},
            {pControl->winrect.left + 10,pControl->winrect.top + 28,100,28},
            {pControl->winrect.left + 10,pControl->winrect.top + 56,100,28},
            {pControl->winrect.left + 10,pControl->winrect.top + 84,100,28},
            
            {pControl->winrect.left + 110,pControl->winrect.top + 0,160,28},
            {pControl->winrect.left + 110,pControl->winrect.top + 28,160,28},
            {pControl->winrect.left + 110,pControl->winrect.top + 56,160,28},
            {pControl->winrect.left + 110,pControl->winrect.top + 84,160,28},            
            };
            for(iLoop=0; iLoop < 9; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &VgaDrawRect[iLoop], sizeof(RECT));
            break ;	
	#endif
    }//end of switch
    return;
}

HWND *CreateControlMusic_FileInfo_Panel(HWND *pParent,INT8U CurOsdSize)
{
    //Create Control -- Music_FileInfo_Panel
    HWND *pNewControl;
    switch(CurOsdSize){
	case OsdSize576i:
	case OsdSize576p:
	case OsdSize576iCVBS:	
            pNewControl = AWCreateWinControl("TControl","Music_FileInfo_Panel",(WS_CHILDWINDOW | WS_CHILDWINDOW),
		                      362,332,290,138,pParent,0,NULL) ;
            pNewControl->win_id = 15 ;
            pNewControl->draw_info_num = 9;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO Draw576DrawDatas[9] = {
                          {0,0,290,174,(INT32U)ICON_INFO_BACKGROUNG,DT_RLE_BMP_DATA},

                          {0,6,100,36,(INT32U)debug_string[0],DT_STRING_DATA},
                          {0,42,100,36,(INT32U)debug_string[1],DT_STRING_DATA},
                          {0,78,100,36,(INT32U)debug_string[2],DT_STRING_DATA},
                          {0,114,100,36,(INT32U)debug_string[3],DT_STRING_DATA},

                          {0,6,160,36,(INT32U)debug_string[4],DT_STRING_DATA},
                          {0,42,160,36,(INT32U)debug_string[5],DT_STRING_DATA},
                          {0,78,160,36,(INT32U)debug_string[6],DT_STRING_DATA},
                          {0,114,160,36,(INT32U)debug_string[7],DT_STRING_DATA},
                          };
            memcpy(pNewControl->draw_info,Draw576DrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;
            			
	case OsdSize480i:
	case OsdSize480p:
	case OsdSize480iCVBS:	
            pNewControl = AWCreateWinControl("TControl","Music_FileInfo_Panel",(WS_CHILDWINDOW | WS_CHILDWINDOW),
		                      392,284,290,138,pParent,0,NULL) ;
            pNewControl->win_id = 15 ;
            pNewControl->draw_info_num = 9;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO NormalDrawDatas[9] = {
                          {0,0,290,174,(INT32U)ICON_INFO_BACKGROUNG,DT_RLE_BMP_DATA},

                          {0,6,100,36,(INT32U)debug_string[0],DT_STRING_DATA},
                          {0,42,100,36,(INT32U)debug_string[1],DT_STRING_DATA},
                          {0,78,100,36,(INT32U)debug_string[2],DT_STRING_DATA},
                          {0,114,100,36,(INT32U)debug_string[3],DT_STRING_DATA},

                          {0,6,160,36,(INT32U)debug_string[4],DT_STRING_DATA},
                          {0,42,160,36,(INT32U)debug_string[5],DT_STRING_DATA},
                          {0,78,160,36,(INT32U)debug_string[6],DT_STRING_DATA},
                          {0,114,160,36,(INT32U)debug_string[7],DT_STRING_DATA},
                          };
            memcpy(pNewControl->draw_info,NormalDrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;

	#ifdef SUPPORT_VGA
	case OsdSizeVga:
            pNewControl = AWCreateWinControl("TControl","Music_FileInfo_Panel",(WS_CHILDWINDOW | WS_CHILDWINDOW),
		                      392+WinStart_x,284+WinStart_y,290,138,pParent,0,NULL) ; ////?????????????
            pNewControl->win_id = 15 ;
            pNewControl->draw_info_num = 9;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO VgaDrawDatas[9] = {
                          {0,0,290,174,(INT32U)ICON_INFO_BACKGROUNG,DT_RLE_BMP_DATA},

                          {0,6,100,36,(INT32U)debug_string[0],DT_STRING_DATA},
                          {0,42,100,36,(INT32U)debug_string[1],DT_STRING_DATA},
                          {0,78,100,36,(INT32U)debug_string[2],DT_STRING_DATA},
                          {0,114,100,36,(INT32U)debug_string[3],DT_STRING_DATA},

                          {0,6,160,36,(INT32U)debug_string[4],DT_STRING_DATA},
                          {0,42,160,36,(INT32U)debug_string[5],DT_STRING_DATA},
                          {0,78,160,36,(INT32U)debug_string[6],DT_STRING_DATA},
                          {0,114,160,36,(INT32U)debug_string[7],DT_STRING_DATA},
                          };
            memcpy(pNewControl->draw_info,VgaDrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;		
	#endif
    }//end of switch
            return pNewControl;
}

void SetVideo_PreviewScreen_ScreenPos(HWND* pControl, INT8U CurOsdSize)
{
    int iLoop;
    switch(CurOsdSize){
	case OsdSize576i:
	case OsdSize576p:
	case OsdSize576iCVBS:	
            pControl->winrect.top = pControl->parent->winrect.top + 160;
            pControl->winrect.left = pControl->parent->winrect.left + 390;
            pControl->winrect.width = 256;
            pControl->winrect.height = 194;
            pControl->draw_info_num = 2;
            RECT Draw576DrawRect[2] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,256,194},
            {pControl->winrect.left + 3,pControl->winrect.top + 3,250,188},
            };
            for(iLoop=0; iLoop < 2; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &Draw576DrawRect[iLoop], sizeof(RECT));
            break ;
            
	case OsdSize480i:
	case OsdSize480p:
	case OsdSize480iCVBS:	
            pControl->winrect.top = pControl->parent->winrect.top + 112;
            pControl->winrect.left = pControl->parent->winrect.left + 390;
            pControl->winrect.width = 256;
            pControl->winrect.height = 194;
            pControl->draw_info_num = 2;
            RECT NormalDrawRect[2] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,256,194},
            {pControl->winrect.left + 3,pControl->winrect.top + 3,250,188},
            };
            for(iLoop=0; iLoop < 2; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &NormalDrawRect[iLoop], sizeof(RECT));
            break ;

	#ifdef SUPPORT_VGA
	case OsdSizeVga:
            pControl->winrect.top = pControl->parent->winrect.top + 112+WinStart_y;
            pControl->winrect.left = pControl->parent->winrect.left + 390+WinStart_x;
            pControl->winrect.width = 256;
            pControl->winrect.height = 194;
            pControl->draw_info_num = 2;
            RECT VgaDrawRect[2] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,256,194},
            {pControl->winrect.left + 3,pControl->winrect.top + 3,250,188},
            };
            for(iLoop=0; iLoop < 2; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &VgaDrawRect[iLoop], sizeof(RECT));
            break ;	
	#endif
    }//end of switch
    return;
}

INT32S Video_PreviewScreen_ScreenMsgProc(PHWND hwnd, INT32U msg_type, INT32S lpParam)
{
    switch( msg_type){
        case WM_SHOWWINDOW:
            return Video_PreviewScreen_ScreenOnShow(hwnd, lpParam) ;
    }
    return 0 ;
}


HWND *CreateControlVideo_PreviewScreen_Screen(HWND *pParent,INT8U CurOsdSize)
{
    //Create Control -- Video_PreviewScreen_Screen
    HWND *pNewControl;
    switch(CurOsdSize){
	case OsdSize576i:
	case OsdSize576p:
	case OsdSize576iCVBS:	
            pNewControl = AWCreateWinControl("TControl","Video_PreviewScreen_Screen",(WS_CHILDWINDOW | WS_DISVISIBLE),
							  390,160,256,194,pParent,0,Video_PreviewScreen_ScreenMsgProc) ;
            pNewControl->win_id = 16 ;
            pNewControl->draw_info_num = 2;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO Draw576DrawDatas[2] = {
                          {0,0,0,0,(INT32U)ICON_MOVIE_PREV_BACKGROUND,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)ICON_60,DT_RLE_BMP_DATA}
                          };
            memcpy(pNewControl->draw_info,Draw576DrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;
            
	case OsdSize480i:
	case OsdSize480p:
	case OsdSize480iCVBS:	
            pNewControl = AWCreateWinControl("TControl","Video_PreviewScreen_Screen",(WS_CHILDWINDOW | WS_DISVISIBLE),
		                      390,112,256,194,pParent,0,Video_PreviewScreen_ScreenMsgProc) ;
            pNewControl->win_id = 16 ;
            pNewControl->draw_info_num = 2;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO NormalDrawDatas[2] = {
                          {0,0,0,0,(INT32U)ICON_MOVIE_PREV_BACKGROUND,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)ICON_60,DT_RLE_BMP_DATA}
                          };
            memcpy(pNewControl->draw_info,NormalDrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;

	#ifdef SUPPORT_VGA
	case OsdSizeVga:
            pNewControl = AWCreateWinControl("TControl","Video_PreviewScreen_Screen",(WS_CHILDWINDOW | WS_DISVISIBLE),
		                      390+WinStart_x,112+WinStart_y,256,194,pParent,0,Video_PreviewScreen_ScreenMsgProc) ;
            pNewControl->win_id = 16 ;
            pNewControl->draw_info_num = 2;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO VgaDrawDatas[2] = {
                          {0,0,0,0,(INT32U)ICON_MOVIE_PREV_BACKGROUND,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)ICON_60,DT_RLE_BMP_DATA}
                          };
            memcpy(pNewControl->draw_info,VgaDrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;	
	#endif
    }//end of switch
            return pNewControl;
}


void SetVideo_FileInfo_PanelPos(HWND* pControl, INT8U CurOsdSize)
{
    int iLoop;
    switch(CurOsdSize){
	case OsdSize576i:
	case OsdSize576p:
	case OsdSize576iCVBS:	
            pControl->winrect.top = pControl->parent->winrect.top + 366;
            pControl->winrect.left = pControl->parent->winrect.left + 376;
            pControl->winrect.width = 274;
            pControl->winrect.height = 98;
            pControl->draw_info_num = 7;
            RECT Draw576DrawRect[7] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,274,98},
            
            {pControl->winrect.left + 5,pControl->winrect.top + 15,100,30},
            {pControl->winrect.left + 5,pControl->winrect.top + 40,100,30},
            {pControl->winrect.left + 5,pControl->winrect.top + 65,100,30},
            
            {pControl->winrect.left + 105,pControl->winrect.top + 15,165,30},
            {pControl->winrect.left + 105,pControl->winrect.top + 40,165,30},
            {pControl->winrect.left + 105,pControl->winrect.top + 65,165,30},            
            };
            for(iLoop=0; iLoop < 7; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &Draw576DrawRect[iLoop], sizeof(RECT));
            break ;
            
	case OsdSize480i:
	case OsdSize480p:
	case OsdSize480iCVBS:	
            pControl->winrect.top = pControl->parent->winrect.top + 318;
            pControl->winrect.left = pControl->parent->winrect.left + 376;
            pControl->winrect.width = 274;
            pControl->winrect.height = 98;
            pControl->draw_info_num = 7;
            RECT NormalDrawRect[7] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,274,98},
            
            {pControl->winrect.left + 5,pControl->winrect.top + 15,100,30},
            {pControl->winrect.left + 5,pControl->winrect.top + 40,100,30},
            {pControl->winrect.left + 5,pControl->winrect.top + 65,100,30},
            
            {pControl->winrect.left + 105,pControl->winrect.top + 15,160,30},
            {pControl->winrect.left + 105,pControl->winrect.top + 40,160,30},
            {pControl->winrect.left + 105,pControl->winrect.top + 65,160,30},            
            };
            for(iLoop=0; iLoop < 7; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &NormalDrawRect[iLoop], sizeof(RECT));
            break ;
			
	#ifdef SUPPORT_VGA
	case OsdSizeVga:
            pControl->winrect.top = pControl->parent->winrect.top + 318+WinStart_y;
            pControl->winrect.left = pControl->parent->winrect.left + 376+WinStart_x;
            pControl->winrect.width = 274;
            pControl->winrect.height = 98;
            pControl->draw_info_num = 7;
            RECT VgaDrawRect[7] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,274,98},
            
            {pControl->winrect.left + 5,pControl->winrect.top + 15,100,30},
            {pControl->winrect.left + 5,pControl->winrect.top + 40,100,30},
            {pControl->winrect.left + 5,pControl->winrect.top + 65,100,30},
            
            {pControl->winrect.left + 105,pControl->winrect.top + 15,160,30},
            {pControl->winrect.left + 105,pControl->winrect.top + 40,160,30},
            {pControl->winrect.left + 105,pControl->winrect.top + 65,160,30},            
            };
            for(iLoop=0; iLoop < 7; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &VgaDrawRect[iLoop], sizeof(RECT));
            break ;		
	#endif
    }//end of switch
    return;
}

HWND *CreateControlVideo_FileInfo_Panel(HWND *pParent,INT8U CurOsdSize)
{
    //Create Control -- Video_FileInfo_Panel
    HWND *pNewControl;
    switch(CurOsdSize){
	case OsdSize576i:
	case OsdSize576p:
	case OsdSize576iCVBS:	
            pNewControl = AWCreateWinControl("TControl","Video_FileInfo_Panel",(WS_CHILDWINDOW | WS_CHILDWINDOW),
		                      376,366,274,98,pParent,0,NULL) ;
            pNewControl->win_id = 17 ;
            pNewControl->draw_info_num = 7;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO Draw576DrawDatas[7] = {
                          {0,0,274,98,(INT32U)ICON_MOVIE_INFOR,DT_RLE_BMP_DATA},

                          {0,6,100,30,(INT32U)debug_string[0],DT_STRING_DATA},
                          {0,36,100,30,(INT32U)debug_string[1],DT_STRING_DATA},
                          {0,66,100,30,(INT32U)debug_string[2],DT_STRING_DATA},                          
                          
                          {100,6,160,30,(INT32U)debug_string[3],DT_STRING_DATA},
                          {100,36,160,30,(INT32U)debug_string[4],DT_STRING_DATA},
                          {100,66,160,30,(INT32U)debug_string[5],DT_STRING_DATA}
                          };
            memcpy(pNewControl->draw_info,Draw576DrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;
            
	case OsdSize480i:
	case OsdSize480p:
	case OsdSize480iCVBS:	
            pNewControl = AWCreateWinControl("TControl","Video_FileInfo_Panel",(WS_CHILDWINDOW | WS_CHILDWINDOW),
		                      376,318,274,98,pParent,0,NULL) ;
            pNewControl->win_id = 17 ;
            pNewControl->draw_info_num = 7;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO NormalDrawDatas[7] = {
                          {0,0,274,98,(INT32U)ICON_MOVIE_INFOR,DT_RLE_BMP_DATA},

                          {0,6,100,30,(INT32U)debug_string[0],DT_STRING_DATA},
                          {0,36,100,30,(INT32U)debug_string[1],DT_STRING_DATA},
                          {0,66,100,30,(INT32U)debug_string[2],DT_STRING_DATA},                          
                          
                          {100,6,160,30,(INT32U)debug_string[3],DT_STRING_DATA},
                          {100,36,160,30,(INT32U)debug_string[4],DT_STRING_DATA},
                          {100,66,160,30,(INT32U)debug_string[5],DT_STRING_DATA}
                          };
            memcpy(pNewControl->draw_info,NormalDrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;

	#ifdef SUPPORT_VGA
	case OsdSizeVga:
            pNewControl = AWCreateWinControl("TControl","Video_FileInfo_Panel",(WS_CHILDWINDOW | WS_CHILDWINDOW),
		                      376+WinStart_x,318+WinStart_y,274,98,pParent,0,NULL) ;
            pNewControl->win_id = 17 ;
            pNewControl->draw_info_num = 7;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO VgaDrawDatas[7] = {
                          {0,0,274,98,(INT32U)ICON_MOVIE_INFOR,DT_RLE_BMP_DATA},

                          {0,6,100,30,(INT32U)debug_string[0],DT_STRING_DATA},
                          {0,36,100,30,(INT32U)debug_string[1],DT_STRING_DATA},
                          {0,66,100,30,(INT32U)debug_string[2],DT_STRING_DATA},                          
                          
                          {100,6,160,30,(INT32U)debug_string[3],DT_STRING_DATA},
                          {100,36,160,30,(INT32U)debug_string[4],DT_STRING_DATA},
                          {100,66,160,30,(INT32U)debug_string[5],DT_STRING_DATA}
                          };
            memcpy(pNewControl->draw_info,VgaDrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;		
	#endif
    }//end of switch
            return pNewControl;
}


void SetSound_Volume_PanelPos(HWND* pControl, INT8U CurOsdSize)
{
    int iLoop;
    switch(CurOsdSize){
	case OsdSize576i:
	case OsdSize576p:
	case OsdSize576iCVBS:	
            pControl->winrect.top = pControl->parent->winrect.top + 80;
            pControl->winrect.left = pControl->parent->winrect.left + 580;
            pControl->winrect.width = 74;
            pControl->winrect.height = 46;
            pControl->draw_info_num = 2;
            RECT Draw576DrawRect[2] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,50,46},
            {pControl->winrect.left + 50,pControl->winrect.top + 0,24,46},
            };
            for(iLoop=0; iLoop < 2; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &Draw576DrawRect[iLoop], sizeof(RECT));
            break ;
            
	case OsdSize480i:
	case OsdSize480p:
	case OsdSize480iCVBS:
            pControl->winrect.top = pControl->parent->winrect.top + 32;
            pControl->winrect.left = pControl->parent->winrect.left + 580;
            pControl->winrect.width = 74;
            pControl->winrect.height = 46;
            pControl->draw_info_num = 2;
            RECT NormalDrawRect[2] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,50,46},
            {pControl->winrect.left + 50,pControl->winrect.top + 0,24,46},
            };
            for(iLoop=0; iLoop < 2; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &NormalDrawRect[iLoop], sizeof(RECT));
            break ;

	#ifdef SUPPORT_VGA
	case OsdSizeVga:
            pControl->winrect.top = pControl->parent->winrect.top + 32+WinStart_y;
            pControl->winrect.left = pControl->parent->winrect.left + 580+WinStart_x;
            pControl->winrect.width = 74;
            pControl->winrect.height = 46;
            pControl->draw_info_num = 2;
            RECT VgaDrawRect[2] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,50,46},
            {pControl->winrect.left + 50,pControl->winrect.top + 0,24,46},
            };
            for(iLoop=0; iLoop < 2; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &VgaDrawRect[iLoop], sizeof(RECT));
            break ;	
	#endif
    }//end of switch
    return;
}

HWND *CreateControlSound_Volume_Panel(HWND *pParent,INT8U CurOsdSize)
{
    //Create Control -- Sound_Volume_Panel
    HWND *pNewControl;
    switch(CurOsdSize){
	case OsdSize576i:
	case OsdSize576p:
	case OsdSize576iCVBS:	
            pNewControl = AWCreateWinControl("TControl","Sound_Volume_Panel",(WS_CHILDWINDOW | WS_CHILDWINDOW),
		                      580,80,74,46,pParent,0,NULL) ;
            pNewControl->win_id = 18 ;
            pNewControl->draw_info_num = 2;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO Draw576DrawDatas[2] = {
                          {0,0,0,0,(INT32U)ICON_SPEAKER,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)ICON_VOLUME0,DT_RLE_BMP_DATA}};
            memcpy(pNewControl->draw_info,Draw576DrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;
            
	case OsdSize480i:
	case OsdSize480p:
	case OsdSize480iCVBS:	
            pNewControl = AWCreateWinControl("TControl","Sound_Volume_Panel",(WS_CHILDWINDOW | WS_CHILDWINDOW),
		                      580,32,74,46,pParent,0,NULL) ;
            pNewControl->win_id = 18 ;
            pNewControl->draw_info_num = 2;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO NormalDrawDatas[2] = {
                          {0,0,0,0,(INT32U)ICON_SPEAKER,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)ICON_VOLUME0,DT_RLE_BMP_DATA}};
            memcpy(pNewControl->draw_info,NormalDrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;

	#ifdef SUPPORT_VGA
	case OsdSizeVga:
            pNewControl = AWCreateWinControl("TControl","Sound_Volume_Panel",(WS_CHILDWINDOW | WS_CHILDWINDOW),
		                      580+WinStart_x,32+WinStart_y,74,46,pParent,0,NULL) ;
            pNewControl->win_id = 18 ;
            pNewControl->draw_info_num = 2;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO VgaDrawDatas[2] = {
                          {0,0,0,0,(INT32U)ICON_SPEAKER,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)ICON_VOLUME0,DT_RLE_BMP_DATA}};
            memcpy(pNewControl->draw_info,VgaDrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;		
	#endif
    }//end of switch
            return pNewControl;
}

void SetMedia_FileList_BK_PanelPos(HWND* pControl, INT8U CurOsdSize)
{
    int iLoop;
    switch(CurOsdSize){
	case OsdSize576i:
	case OsdSize576p:
	case OsdSize576iCVBS:	
            pControl->winrect.top = pControl->parent->winrect.top + 0;
            pControl->winrect.left = pControl->parent->winrect.left + 0;
            pControl->winrect.width = 720;
            pControl->winrect.height = 576;
            pControl->draw_info_num = 8;
            RECT Draw576DrawRect[8] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 48,720,480},
            {pControl->winrect.left + 72,pControl->winrect.top + 170,22,22},
            {pControl->winrect.left + 72,pControl->winrect.top + 414,22,22},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,0,0},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,0,0},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,720,48},
            {pControl->winrect.left + 0,pControl->winrect.top + 528,720,48},
			{pControl->winrect.left + 362,pControl->winrect.top + 154,294,122},
            };
            for(iLoop=0; iLoop < 8; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &Draw576DrawRect[iLoop], sizeof(RECT));
            break ;

	case OsdSize480i:
	case OsdSize480p:
	case OsdSize480iCVBS:	
            pControl->winrect.top = pControl->parent->winrect.top + 0;
            pControl->winrect.left = pControl->parent->winrect.left + 0;
            pControl->winrect.width = 720;
            pControl->winrect.height = 480;
            pControl->draw_info_num = 8;
            RECT NormalDrawRect[8] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,720,480},
            {pControl->winrect.left + 72,pControl->winrect.top + 122,22,22},
            {pControl->winrect.left + 72,pControl->winrect.top + 366,22,22},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,0,0},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,0,0},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,0,0},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,0,0},
            {pControl->winrect.left + 362,pControl->winrect.top + 106,294,122},
            };
            for(iLoop=0; iLoop < 8; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &NormalDrawRect[iLoop], sizeof(RECT));
            break ;

	#ifdef SUPPORT_VGA
	case OsdSizeVga:
            pControl->winrect.top = pControl->parent->winrect.top + 0;
            pControl->winrect.left = pControl->parent->winrect.left + 0;
            pControl->winrect.width = 1024;
            pControl->winrect.height = 768;
            pControl->draw_info_num = 8;
            RECT VgaDrawRect[8] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,1024,768},
            {pControl->winrect.left + 72+WinStart_x,pControl->winrect.top + 122+WinStart_y,22,22},
            {pControl->winrect.left + 72+WinStart_x,pControl->winrect.top + 366+WinStart_y,22,22},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,0,0},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,0,0},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,0,0},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,0,0},
            {pControl->winrect.left + 362+WinStart_x,pControl->winrect.top + 106+WinStart_y,294,122},
            };
            for(iLoop=0; iLoop < 8; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &VgaDrawRect[iLoop], sizeof(RECT));
            break ;	
	#endif
    }//end of switch
    return;
}

HWND *CreateControlMedia_FileList_BK_Panel(HWND *pParent,INT8U CurOsdSize)
{
    //Create Control -- Media_FileList_BK_Panel
    HWND *pNewControl;
    switch(CurOsdSize){
	case OsdSize576i:
	case OsdSize576p:
	case OsdSize576iCVBS:	
            pNewControl = AWCreateWinControl("TControl","Media_FileList_BK_Panel",(WS_CHILDWINDOW | WS_CHILDWINDOW),
		                      0,0,720,576,pParent,0,NULL) ;
            pNewControl->win_id = 20 ;
            pNewControl->draw_info_num = 8;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO Draw576DrawDatas[8] = {
			     		  {0,48,720,480,(INT32U)0,DT_RLE_BMP_DATA},
                          {46,170,22,22,(INT32U)ICON_FILELIST_UP,DT_RLE_BMP_DATA},
			     		  {46,414,22,22,(INT32U)ICON_FILELIST_DOWN,DT_RLE_BMP_DATA},            
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_STRING_DATA},
                          {0,0,720,48,(INT32U)ICON_TOP_BOTTOM_BACKGROUND1,DT_RLE_BMP_DATA},
                          {0,528,720,48,(INT32U)ICON_TOP_BOTTOM_BACKGROUND2,DT_RLE_BMP_DATA},
                          {0,0,294,122,(INT32U)ICON_FILELIST_MUSIC_BACKGROUND,DT_RLE_BMP_DATA},
                          };
            memcpy(pNewControl->draw_info,Draw576DrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;
            
	case OsdSize480i:
	case OsdSize480p:
	case OsdSize480iCVBS:	
            pNewControl = AWCreateWinControl("TControl","Media_FileList_BK_Panel",(WS_CHILDWINDOW | WS_CHILDWINDOW),
		                      0,0,720,480,pParent,0,NULL) ;
            pNewControl->win_id = 20 ;
            pNewControl->draw_info_num = 8;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO NormalDrawDatas[8] = {
                          {0,0,720,480,(INT32U)0,DT_RLE_BMP_DATA},
                          {46,122,22,22,(INT32U)ICON_FILELIST_UP,DT_RLE_BMP_DATA},
			     		  {46,366,22,22,(INT32U)ICON_FILELIST_DOWN,DT_RLE_BMP_DATA},            
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_STRING_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
			     		  {0,0,294,122,(INT32U)ICON_FILELIST_MUSIC_BACKGROUND,DT_RLE_BMP_DATA},
                          };
            memcpy(pNewControl->draw_info,NormalDrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;
			
	#ifdef SUPPORT_VGA
	case OsdSizeVga:
            pNewControl = AWCreateWinControl("TControl","Media_FileList_BK_Panel",(WS_CHILDWINDOW | WS_CHILDWINDOW),
		                      0,0,1024,768,pParent,0,NULL) ;
            pNewControl->win_id = 20 ;
            pNewControl->draw_info_num = 8;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;			
            DRAWINFO VgaDrawDatas[8] = {
                          {0,0,1024,768,(INT32U)ICON_PHOTO_BACKGROUND,DT_RLE_BMP_DATA},
                          {46+WinStart_x,122+WinStart_y,22,22,(INT32U)ICON_FILELIST_UP,DT_RLE_BMP_DATA},
			     		  {46+WinStart_x,366+WinStart_y,22,22,(INT32U)ICON_FILELIST_DOWN,DT_RLE_BMP_DATA},            
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_STRING_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
			     		  {0+WinStart_x,0,294+WinStart_y,122,(INT32U)ICON_FILELIST_MUSIC_BACKGROUND,DT_RLE_BMP_DATA},
                          };
            memcpy(pNewControl->draw_info,VgaDrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;		
	#endif
    }//end of switch
            return pNewControl;
}

INT32S MediaTopMsgProc(PHWND hwnd, INT32U msg_type, INT32S lpParam)
{
    switch( msg_type){
        case WM_SHOWWINDOW:
            return MediaToplOnShow(hwnd, lpParam) ;
    }
    return 0 ;
}

void SetMediaTopPos(HWND* pControl, INT8U CurOsdSize)
{
    int iLoop;
    switch(CurOsdSize){
	case OsdSize576i:
	case OsdSize576p:
	case OsdSize576iCVBS:	
            pControl->winrect.top = pControl->parent->winrect.top + 60;
            pControl->winrect.left = pControl->parent->winrect.left + 24;
            pControl->winrect.width = 120;
            pControl->winrect.height = 78;
            pControl->draw_info_num = 1;
            RECT Draw576DrawRect[1] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,120,78},
            };
            for(iLoop=0; iLoop < 1; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &Draw576DrawRect[iLoop], sizeof(RECT));
            break ;
            
	case OsdSize480i:
	case OsdSize480p:
	case OsdSize480iCVBS:
            pControl->winrect.top = pControl->parent->winrect.top + 12;
            pControl->winrect.left = pControl->parent->winrect.left + 24;
            pControl->winrect.width = 120;
            pControl->winrect.height = 78;
            pControl->draw_info_num = 1;
            RECT NormalDrawRect[1] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,120,78},
            };
            for(iLoop=0; iLoop < 1; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &NormalDrawRect[iLoop], sizeof(RECT));
            break ;

	#ifdef SUPPORT_VGA
	case OsdSizeVga:
            pControl->winrect.top = pControl->parent->winrect.top + 12+WinStart_y;
            pControl->winrect.left = pControl->parent->winrect.left + 24+WinStart_x;
            pControl->winrect.width = 120;
            pControl->winrect.height = 78;
            pControl->draw_info_num = 1;
            RECT VgaDrawRect[1] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,120,78},
            };
            for(iLoop=0; iLoop < 1; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &VgaDrawRect[iLoop], sizeof(RECT));
            break ;	
	#endif
    }//end of switch
    return;
}

HWND *CreateControlMediaTop(HWND *pParent,INT8U CurOsdSize)
{
    //Create Control -- MediaTop
    HWND *pNewControl;
    switch(CurOsdSize){
	case OsdSize576i:
	case OsdSize576p:
	case OsdSize576iCVBS:	
            pNewControl = AWCreateWinControl("TControl","MediaTop",(WS_CHILDWINDOW | WS_CHILDWINDOW),
		                      0,48,120,78,pParent,0,MediaTopMsgProc) ;
            pNewControl->win_id = 5 ;
            pNewControl->draw_info_num = 1;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO Draw576DrawDatas[1] = {
                          {0,0,120,78,(INT32U)ICON_MUSIC_TOP,DT_RLE_BMP_DATA}};
            memcpy(pNewControl->draw_info,Draw576DrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;
            
	case OsdSize480i:
	case OsdSize480p:
	case OsdSize480iCVBS:
            pNewControl = AWCreateWinControl("TControl","MediaTop",(WS_CHILDWINDOW | WS_CHILDWINDOW),
		                      0,0,120,78,pParent,0,MediaTopMsgProc) ;
            pNewControl->win_id = 5 ;
            pNewControl->draw_info_num = 1;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO NormalDrawDatas[1] = {
                          {0,0,120,78,(INT32U)ICON_MUSIC_TOP,DT_RLE_BMP_DATA}};
            memcpy(pNewControl->draw_info,NormalDrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;

	#ifdef SUPPORT_VGA
	case OsdSizeVga:
            pNewControl = AWCreateWinControl("TControl","MediaTop",(WS_CHILDWINDOW | WS_CHILDWINDOW),
		                      0+WinStart_x,0+WinStart_y,120,78,pParent,0,MediaTopMsgProc) ;
            pNewControl->win_id = 5 ;
            pNewControl->draw_info_num = 1;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO VgaDrawDatas[1] = {
                          {0,0,120,78,(INT32U)ICON_MUSIC_TOP,DT_RLE_BMP_DATA}};
            memcpy(pNewControl->draw_info,VgaDrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;		
	#endif
    }//end of switch
            return pNewControl;
}

INT32S MoveStringMsgProc(PHWND hwnd, INT32U msg_type, INT32S lpParam)
{
    switch( msg_type){
        case WM_SHOWWINDOW:
            return MoveStringOnShow(hwnd, lpParam) ;
            
		case WM_PAINT:
			return MoveStringOnPaint(hwnd, lpParam);

		default:
			break;
    }
    return 0 ;
}

void SetMoveStringPos(HWND* pControl, INT8U CurOsdSize)
{
    int iLoop;
    switch(CurOsdSize){
	case OsdSize576i:
	case OsdSize576p:
	case OsdSize576iCVBS:	
            pControl->winrect.top = pControl->parent->winrect.top + 0;
            pControl->winrect.left = pControl->parent->winrect.left + 0;
            pControl->winrect.width = 198;
            pControl->winrect.height = 36;
            pControl->draw_info_num = 2;
            RECT Draw576DrawRect[2] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,198,36},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,160,36},
            };
            for(iLoop=0; iLoop < 2; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &Draw576DrawRect[iLoop], sizeof(RECT));
            break ;
            
	case OsdSize480i:
	case OsdSize480p:
	case OsdSize480iCVBS:	
            pControl->winrect.top = pControl->parent->winrect.top + 0;
            pControl->winrect.left = pControl->parent->winrect.left + 0;
            pControl->winrect.width = 198;
            pControl->winrect.height = 36;
            pControl->draw_info_num = 2;
            RECT NormalDrawRect[2] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,198,36},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,160,36},
            };
            for(iLoop=0; iLoop < 2; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &NormalDrawRect[iLoop], sizeof(RECT));
            break ;

	#ifdef SUPPORT_VGA
	case OsdSizeVga:
            pControl->winrect.top = pControl->parent->winrect.top + 0+WinStart_y;
            pControl->winrect.left = pControl->parent->winrect.left + 0+WinStart_x;
            pControl->winrect.width = 198;
            pControl->winrect.height = 36;
            pControl->draw_info_num = 2;
            RECT VgaDrawRect[2] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,198,36},
            {pControl->winrect.left + 0,pControl->winrect.top + 0,160,36},
            };
            for(iLoop=0; iLoop < 2; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &VgaDrawRect[iLoop], sizeof(RECT));
            break ;	
	#endif
    }//end of switch
    return;
}

HWND *CreateControlMoveString(HWND *pParent,INT8U CurOsdSize)
{
    //Create Control -- MoveString
    HWND *pNewControl;
    switch(CurOsdSize){
	case OsdSize576i:
	case OsdSize576p:
	case OsdSize576iCVBS:	
            pNewControl = AWCreateWinControl("TControl","MoveString",(WS_CHILDWINDOW | WS_DISVISIBLE) ,
							  0,0,198,36,pParent,0,MoveStringMsgProc) ;
            pNewControl->win_id = 7 ;
            pNewControl->draw_info_num = 2;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO Draw576DrawDatas[2] = {
            			  {0,0,198,36,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,160,36,(INT32U)0,DT_VOSD_DATA}};
            memcpy(pNewControl->draw_info,Draw576DrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;
            
	case OsdSize480i:
	case OsdSize480p:
	case OsdSize480iCVBS:	
            pNewControl = AWCreateWinControl("TControl","MoveString",(WS_CHILDWINDOW | WS_DISVISIBLE),
		                      0,0,198,36,pParent,0,MoveStringMsgProc) ;
            pNewControl->win_id = 7 ;
            pNewControl->draw_info_num = 2;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO NormalDrawDatas[2] = {
            			  {0,0,198,36,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,160,36,(INT32U)0,DT_VOSD_DATA}};
            memcpy(pNewControl->draw_info,NormalDrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;

	#ifdef SUPPORT_VGA
	case OsdSizeVga:
            pNewControl = AWCreateWinControl("TControl","MoveString",(WS_CHILDWINDOW | WS_DISVISIBLE),
		                      0+WinStart_x,0+WinStart_y,198,36,pParent,0,MoveStringMsgProc) ;
            pNewControl->win_id = 7 ;
            pNewControl->draw_info_num = 2;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO VgaDrawDatas[2] = {
            			  {0,0,198,36,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,160,36,(INT32U)0,DT_VOSD_DATA}};
            memcpy(pNewControl->draw_info,VgaDrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            break ;	
	#endif
    }//end of switch
            return pNewControl;
}



HWND* CreateMenuWinLogo(void)
{
    HWND *pNewControl ;
    TWINDOWS *pWin;
    HWND *pWinLogo = CreateControlWinLogo(NULL,CurrentOsdSize);
    SetWinLogoPos(pWinLogo,CurrentOsdSize);

    pNewControl= CreateControlMediaTop(pWinLogo,CurrentOsdSize);
    SetMediaTopPos(pNewControl,CurrentOsdSize);

    pNewControl= CreateControlFileListView(pWinLogo,CurrentOsdSize);
    SetFileListViewPos(pNewControl,CurrentOsdSize);

    pNewControl= CreateControlMoveString(pWinLogo,CurrentOsdSize);
    SetMoveStringPos(pNewControl,CurrentOsdSize);

    pNewControl= CreateControlMusic_Spectrum_Panel(pWinLogo,CurrentOsdSize);
    SetMusic_Spectrum_PanelPos(pNewControl,CurrentOsdSize);

    pNewControl= CreateControlMusic_ProcessBar_Panel(pWinLogo,CurrentOsdSize);
    SetMusic_ProcessBar_PanelPos(pNewControl,CurrentOsdSize);

    pNewControl= CreateControlMusic_FileInfo_Panel(pWinLogo,CurrentOsdSize);
    SetMusic_FileInfo_PanelPos(pNewControl,CurrentOsdSize);

    pNewControl= CreateControlVideo_PreviewScreen_Screen(pWinLogo,CurrentOsdSize);
    SetVideo_PreviewScreen_ScreenPos(pNewControl,CurrentOsdSize);

    pNewControl= CreateControlVideo_FileInfo_Panel(pWinLogo,CurrentOsdSize);
    SetVideo_FileInfo_PanelPos(pNewControl,CurrentOsdSize);

    pNewControl= CreateControlSound_Volume_Panel(pWinLogo,CurrentOsdSize);
    SetSound_Volume_PanelPos(pNewControl,CurrentOsdSize);

    pNewControl= CreateControlMedia_FileList_BK_Panel(pWinLogo,CurrentOsdSize);
    SetMedia_FileList_BK_PanelPos(pNewControl,CurrentOsdSize);
    
    pWin = (TWINDOWS *)pWinLogo;
    pWin->pFocusControl = AWFindWinCtrlByName("FileListView");
    return pWinLogo;
}

void WinResetWinLogoControlsPos(HWND *pControl, INT8U CurOsdSize)
{
    switch(pControl->win_id){
        case 0://WinLogo
            SetWinLogoPos(pControl,CurOsdSize) ;
            break ;
        case 5://MediaTop
            SetMediaTopPos(pControl,CurOsdSize) ;            
            break ;
        case 6://FileListView
            SetFileListViewPos(pControl,CurOsdSize) ;
            break ;
        case 7://MoveString
            SetMoveStringPos(pControl,CurOsdSize) ;            
            break ;            
        case 13://Music_Spectrum_Panel
            SetMusic_Spectrum_PanelPos(pControl,CurOsdSize) ;
            break ;
        case 14://Music_ProcessBar_Panel
            SetMusic_ProcessBar_PanelPos(pControl,CurOsdSize) ;
            break ;
        case 15://Music_FileInfo_Panel
            SetMusic_FileInfo_PanelPos(pControl,CurOsdSize) ;
            break ;
        case 16://Video_PreviewScreen_Screen
            SetVideo_PreviewScreen_ScreenPos(pControl,CurOsdSize) ;
            break ;
        case 17://Video_FileInfo_Panel
            SetVideo_FileInfo_PanelPos(pControl,CurOsdSize) ;
            break ;
        case 18://Sound_Volume_Panel
            SetSound_Volume_PanelPos(pControl,CurOsdSize) ;
            break ;
        case 20://Media_FileList_BK_Panel
            SetMedia_FileList_BK_PanelPos(pControl,CurOsdSize) ;
            break ;
    }//end of switch
}
void WinResetWinLogoPos(HWND *pControl, INT8U CurOsdSize)
{
    HWND *pChildControl;
    if(pControl == NULL)
        pControl = AWFindWinCtrlByName("WinLogo");
    if(pControl == NULL) return ;

    WinResetWinLogoControlsPos(pControl, CurOsdSize) ;
    pChildControl = pControl->children ;
    while(pChildControl != NULL){
    	WinResetWinLogoPos(pChildControl, CurOsdSize) ;
    	pChildControl = pChildControl->siblings ;
	}
	return ;
}

